home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows News 2010 Summer - Disc 1
/
WN_Ete2010_CD1.iso
/
Onglet5
/
Weezo
/
Weezo setup.exe
/
{code_appDir}
/
www
/
local
/
userIcon.php
< prev
next >
Wrap
PHP Script
|
2010-05-19
|
4KB
|
105 lines
<?php
/**
* IP restriction message boxes
*
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category NA
* @package NA
* @author Nicolas Bruley / Peer 2 World <contact@weezo.net>
* @copyright 2005-2009 Nicolas Bruley / Peer 2 World
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
* @link http://www.weezo.net
* @since File available since Release 2.0.0
*/
if(!cfIsInApp()) die();
require_once(INCLUDE_DIR.'outputFunctions.php');
require_once(INCLUDE_DIR.'explorerFunctions.php');
// Get User Id & user
$userId=(isset($_GET['userId']))?$_GET['userId']:@$_POST['userId'];
if(!$userId || !($user=cfArrayItem(cfMGetVar('weezoUsers'),$userId))) die('incorrect user Id');
$userIcon=$user['icon'];
/*
***************************************************************************************************************************
* Process POST commands
***************************************************************************************************************************
*/
// Add a new icon
if(isset($_POST['addIcon']) && file_exists($cfn=cfUTF8Decode(str_replace('\\','/',$_POST['addIcon'])))){
$basename=cfAppDocRoot().'/gfx/icons/'.cfFileWithoutExtension(basename($cfn));
$i=0;
$ext='.jpg';
while (file_exists($basename.$ext)) {
$i++;
$ext=' ('.$i.').jpg';
}
cfCreateResizedJPG($cfn,0,0,$basename.$ext,80,80,5,false,0,true,true);
$userIcon=basename($basename.$ext);
}
/*
***************************************************************************************************************************
* Display page
***************************************************************************************************************************
*/
cfInsertHEAD(false);
?>
<meta width="600x550"></meta>
<meta title="<?php echo APPLICATION_NAME;?>"></meta>
<script type="text/javascript">
function browseImages(){
wl.UICommand('openFile','*.jpg;*.jpeg;*.gif;*.bmp;*.png:selectedImage')
}
function browseImagesProceed(cfn){
wl.postData({'addIcon':cfn,'userId':'<?php echo $userId;?>'})
}
function go(){
var sel= wl.blockItemGroup('userIcons').getSelectedItemsIds().toString().substr(2);
wl.UICommand('close',sel)
}
function cancel(){wl.UICommand('close')}
</script>
</head>
<body style="overflow:hidden">
<input name="selectedImage" onkeyup="browseImagesProceed(this.value)" style="display:none">
<?php
echo outDivFrame('frame1');
echo outFrameHeaderTable('frame1Header',outImageIcon('chat').cfCaption('userIcon'),outButton(cfCaption('genBrowse'),'javascript:browseImages()',outIcon('blankFile')));
echo '<center><div class="frame2" style="width:590px;height:480px;overflow:scroll;margin-top:0.5em;margin-bottom:0.5em;text-align:left">';
// List icons
foreach (cfGlob(cfAppDocRoot().'/gfx/icons/*.*') as $cfn) if(efFileType($cfn)=='image') $list[$cfn]=filectime($cfn);
// Revert-sort by creation date
arsort($list);
// Display icons
foreach ($list as $cfn=>$cdate){
echo outBlockItem('userIcons',outImage('/gfx/icons/'.basename($cfn)),'id="uI'.basename($cfn).'" ondblclick="go()"','width:100px;height:100px;padding:10px',false,((basename($cfn)==$userIcon)?'sel':'unsel'));
}
echo '</div>';
// OK & Cancel buttons
echo outBt(cfCaption('genOK'),outIcon('ok'),'javascript:go()', false,false,'style="margin-right:10em"','up',120);
echo outBt(cfCaption('genCancel'),outIcon('cancel'),'javascript:cancel()',false,false,false,'up',120);
?>
</center>
</div>
</body>